package com.example.myimg;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.Toast;

import com.bumptech.glide.Glide;

import java.io.IOException;

public class MainActivity extends AppCompatActivity {
    @Override
    public void onBackPressed() {
        super.onBackPressed();
        Toast.makeText(MainActivity.this,"这就完事了？",Toast.LENGTH_SHORT).show();
        finish();
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_main);
        ProgressBar progressBar=(ProgressBar)findViewById(R.id.progress_bar);
        progressBar.setVisibility(View.INVISIBLE);
        final MyImageView myImageView = (MyImageView) findViewById(R.id.image_view);
        myImageView.setImageURL("http://fenchingking.top/photoApi/api");
        Button button = (Button) findViewById(R.id.button);
        button.setOnClickListener(new View.OnClickListener() {
            int times=0;
            @Override
            public void onClick(View v) {
                times++;
                if(times==5)
                {
                    Toast.makeText(MainActivity.this,"别硬了别硬了",Toast.LENGTH_SHORT).show();
                }
                if(times==11)
                {
                    Toast.makeText(MainActivity.this,"你已经很硬了",Toast.LENGTH_SHORT).show();
                    finish();
                }
                myImageView.setImageURL("http://fenchingking.top/photoApi/api");
            }
        });
    }
}